package com.fl.nettydemo.c5;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.netty.buffer.CompositeByteBuf;

public class TestByteBuf {
    public static void main(String[] args) {
        //获取buf
        ByteBuf b1 = ByteBufAllocator.DEFAULT.buffer();
        //写入数据
        b1.writeBytes(new byte[]{1,2,3,4});
        ByteBuf b2 = ByteBufAllocator.DEFAULT.buffer();
        b2.writeBytes(new byte[]{5,6,7,8});

        CompositeByteBuf bufs = ByteBufAllocator.DEFAULT.compositeBuffer();
        bufs.addComponents(true,b1,b2);
        System.out.println(bufs.toString());
    }
}
